

export const useRouterRedirect = (router?: any, route?: any, next?: any, normalAddr?: string) => {


  const redirectUrl = route?.query?.redirect;
  const reirectHome = () => {
    next({ path: normalAddr ? normalAddr : "/home" })
  }
  let redirectUrlStr = ''
  if (redirectUrl) {
    redirectUrlStr = redirectUrl.toString();
  }
  // console.log(redirectUrlStr)
  if (redirectUrlStr) {
    if (redirectUrl === "/") {
      reirectHome()
      
    }else{
      next({
        path: redirectUrlStr
      })
    }
    
    return
  } else {
    reirectHome()
  }
  return
}